Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidimensional Views 🦏 #288

Merged
merged 174 commits into from
Mar 17, 2017
Merged

Multidimensional Views 🦏 #288

merged 174 commits into from
Mar 17, 2017

Conversation

fuchsto
Copy link
Member

@fuchsto fuchsto commented Feb 17, 2017

Addresses #192

For use cases of multi-dimensional views, see tests:

https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/NViewTest.cc
https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/ViewTest.cc

Current benchmark results:

gcc 5.4

     units,  elem/unit, iterations,   view.gups,   algo.gups,     speedup
         4,          4,    1000000,      1.8313,      0.4129,      4.4352
         4,         16,     100000,      1.7277,      0.3269,      5.2847
         4,         64,     100000,      1.8660,      0.3332,      5.5995
         4,        256,      10000,      2.1120,      0.3511,      6.0158
         4,       1024,      10000,      2.1328,      0.3505,      6.0849
         4,       4096,       1000,      2.1272,      0.3489,      6.0960
         4,      16384,       5000,      2.1349,      0.3502,      6.0962
         4,      65536,       1000,      2.1363,      0.3502,      6.1007
         4,     262144,        500,      2.1363,      0.3501,      6.1026

This PR also includes some meta-helpers for ranges and container types:

https://github.com/dash-project/dash/blob/feat-192-nviews/dash/include/dash/Meta.h

To test if a type can be used for container elements, use:

static_assert(
  dash::is_container_compatible<ElementType>::value,
  "Type not supported for DASH containers");

This is now used in all available container types.

…feat-192-nviews

Conflicts:
	dash/include/dash/View.h
	dash/include/dash/view/IndexSet.h
	dash/include/dash/view/Sub.h
	dash/test/TestBase.h
@fuchsto fuchsto changed the title [WIP] Multidimensional Views Multidimensional Views Mar 16, 2017
@fuchsto
Copy link
Member Author

fuchsto commented Mar 16, 2017

@fmoessbauer @devreal @rkowalewski Bounce for review!

Copy link
Member

@devreal devreal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many good changes in here! Just some comments inline.

build.dev.sh Outdated
-DENABLE_DEV_COMPILER_WARNINGS=ON \
-DENABLE_EXT_COMPILER_WARNINGS=ON \
-DENABLE_DEV_COMPILER_WARNINGS=OFF \
-DENABLE_EXT_COMPILER_WARNINGS=OFF \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave warnings on by default on dev builds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that was by accident.

/// Number of dimensions of the cartesian space, initialized with 0's.
SizeType _ndim = NumDimensions;
SizeType _rank = NumDimensions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment and real initialization diverge here. I guess initialization with 0 would be correct?

: _gptr(DART_GPTR_NULL) {
}
: _gptr(DART_GPTR_NULL)
{ }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you no delete t'is? ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what the TODO comment refers to. There are situations where GloRef objects are temporarily uninitialized. Perhaps I can eliminate them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out I already did! deleted the default constructor.

class Ref_ >
constexpr GlobViewIter(
// const GlobViewIter<nonconst_value_type, P_, GM_, Ptr_, Ref_> & other)
const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> && other)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> & other for the copy c'tor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@@ -335,7 +335,7 @@ void perform_test(

if (myid == 0) {
if (iteration == 0) {
cout << "-- Pattern: " << pattern << endl
cout << "-- Pattern: " << dash::internal::typestr(pattern) << endl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, but it would be very useful to have some documentation on the dash::internals

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, will add Doxygen comments for the new features. Note that namespace internal is excluded from API docs for obvious reasons. Perhaps some helpers like typestr should be public instead.

typeid(T).name()
);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation! Otherwise we will re-invent this in a couple of month, as no one knows that this exists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment above. I moved dash::internal::typestr to dash::typestr in header dash/meta/TypeInfo.h, it's documented and part of the public API now.

class Ref_ >
constexpr GlobViewIter(
// const GlobViewIter<nonconst_value_type, P_, GM_, Ptr_, Ref_> & other)
const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> && other)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

_globmem,
*_pattern,
g_idx
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine it to an oneliner to enable RVO.

@@ -799,7 +818,6 @@ class BlockPattern<1, Arrangement, IndexType>
/// Global block index
index_type g_block_index) const
{
#if 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why all these #if #else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deactivated code sections are previous implementations before I rewrote them as constexpr. Left them as comments to help debugging in case my constexpr variant was broken. Will remove them.

@@ -1354,15 +1336,15 @@ class TilePattern
/**
* Cartesian arrangement of pattern blocks.
*/
const BlockSpec_t & blockspec() const
constexpr const BlockSpec_t & blockspec() const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can be made noexcept? Same for most of the other methods.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but that's not the actual concern of this PR.

std::vector<iterator> _groups;
std::vector<std::string> _group_domain_tags;
/// Split domains in the team locality, one domain for every split group.
std::vector<self_t> _parts;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these changes in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serendipity.

0, // accumulate init
std::multiplies<index_type>() // reduce op
);
*/
return (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be so beautiful in C++14 ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in CLisp <3

@@ -0,0 +1,11 @@
config:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Do we already have some regression testing provider?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on it, currently works for a prototype on my machine.

virtual ~AccumulateTest() {
LOG_MESSAGE("<<< Closing test suite: AccumulateTest");
}
_dash_size(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IL not necessary as this is derived from TestBase

@fuchsto fuchsto changed the title Multidimensional Views Multidimensional Views 🦏 Mar 17, 2017
@fuchsto fuchsto changed the title Multidimensional Views 🦏 Multidimensional Views 🦏 Mar 17, 2017
@fuchsto
Copy link
Member Author

fuchsto commented Mar 17, 2017

@devreal @fmoessbauer Your requested changes are addressed in my last commits. 🦏

@fuchsto fuchsto merged commit a319e7b into development Mar 17, 2017
@fmoessbauer
Copy link
Member

This is a really really cool feature!!!

@fuchsto
Copy link
Member Author

fuchsto commented Mar 17, 2017

I'm quite satisfied for now, too.
The view expressions make some nasty use cases trivial to handle, like here:

https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/ViewTest.cc#L786

local(blocks(sub(array)))[1].begin()

It's horrible to express manually, even in pseudo code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants